/*
Hermes Core: General Purpose Mobile Agent Platform
Copyright (C) 2006 UNICAM - Università degli Studi di Camerino

Group leaders: Flavio Corradini and Emanuela Merelli

Developers: Ezio Bartocci, Diego Bonura, Rosario Culmone,
Davide Lorenzoli, Leonardo Mariani, Francesca Piersigilli, 
Lorenzo Scortichini, Leonardo Vito.

GNU Lesser Public License

This library is free software; you can redistribute it 
and/or modify it under the terms of the GNU Lesser General 
Public License as published by the Free Software Foundation, 
version 2.1 of the License.

This library is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public 
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.

Emanuela Merelli
Dipartimento di Matematica ed Informatica
Università di Camerino
via Madonna delle Carceri, 62032 Camerino, Italy
E.Mail: emanuela.merelli@unicam.it
*/
package hermesV2.basicServices.genesis;

import hermesV2.agent.Identificator;
import hermesV2.agent.UserAgent;


/**
 * This is the interface of the Genesis component that offers a way to clone
 * agents and  to create new istances of agents giving the name of the agent
 * class. It is also has eh responsability to clean everything when an agent
 * dies.
 *
 * @author Diego Bonura
 * @param <T>
 */
public interface Genesis {
    /**
     * This method permits the clonation of an user agent. It handles the
     * creation of a new identificator and the starting of the cloned agent.
     *
     * @param anAgent The agent to clone.
     * @param agentName The name of the cloned agent.
     * 
     *
     * @return The identificator of the cloned agent.
     */
    public Identificator cloneAgent(UserAgent anAgent,String agentName);

    /**
     * It creates a new agent giving the class of an agent.
     *
     * @param clsAgent The name of the agent class.
     * @param agentName The name of the new agent.
     *
     * @return The identificator of the new agent.
     */
    public Identificator createAgent(Class<?> clsAgent, String agentName);
    
	/**
	 * It creates a new agent giving the class of an agent.
	 * @param <T>
	 * 
	 * @param clsAgent
	 *            The class of the agent.
	 * @param objects
	 * 			  The parameters of the new agent
	 * 
	 * @return The identificator of the new agent.
     */
    public Identificator createAgent(Class<?> clsAgent, Object[] objects);

    /**
     * This method is automatically called when an agent dies. It cleans every
     * hashtables into the current place and it erases the entry into the born
     * place. It uses the EnvelopeIO interface to communicate with remote
     * places.
     *
     * @param agentId The identificator of the agent died.
     */
    public void destroyAgent(Identificator agentId);
}
